package com.ws.shop.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ws.shop.dao.AdminMenuDao;
import com.ws.shop.entity.AdminMenu;
import com.ws.shop.service.AdminMenuService;

@Service(value="adminMenuService")
public class AdminMenuServiceImpl implements AdminMenuService {
	@Resource(name="adminMenuDao")
	private AdminMenuDao adminMenuDao;
	
	@Transactional(rollbackFor=Exception.class)
	public Object[] delMenu(int menuid) {
		return adminMenuDao.delMenu(menuid);
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public List<AdminMenu> getAllAdminMenus() {
		return adminMenuDao.getAllAdminMenus();
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
	public AdminMenu getMenuById(int menuid) {
		return adminMenuDao.getMenuById(menuid);
	}

	@Transactional(rollbackFor=Exception.class)
	public void saveOrUpdate(AdminMenu adminMenu) {
		adminMenuDao.saveOrUpdate(adminMenu);
	}

}
